// Main.cpp
#include <iostream>
#include <fstream>
using namespace std;

#include "Fraction.h"


// Our average template


template<typename T> 
T Average(T * arr, int count)
{
	return Sum(arr,count)/count;
}

//template<typename T> 
//T Average Fraction<T>(T * arr, int count)
//{
//	float total = 0;
//	for(int x = 0; x < count ; x++)
//	{
//		total = total+ arr[x];
//	}
//	return total/count;
//}


// Our sum template
template<typename T>
T Sum(T * arr, int count)
{

	T total = 0;
	for(int x = 0; x < count ; x++)
	{
		total = total+ arr[x];
	}
	return total;
}


// Our arrays for testing
float float_array[] = { 34.2f, 34.2f, 65.3f, 76.3f, 98.2f, 92.1f, 65.3f, 76.2f };
Fraction fraction_array[] = { Fraction(1, 2), Fraction(3,4), Fraction(5, 7), Fraction(3,5), Fraction(6,7) };


int main(void)
{

cout<<1/2;
	// Test averages
Fraction fraction_avg = Average(fraction_array, sizeof(fraction_array) / sizeof(Fraction));
	float float_avg = Average(float_array, sizeof(float_array) / sizeof(float));


	// output
	cout << "Average of the Fractions : " << fraction_avg << '\n';
	cout << "Average of the Floats : " << float_avg << '\n';


	return 0;
}



